class Solution:

    def convert_non_letters_to_space(self, s):
        result = ""
        for char in s:
            if char.isalpha():
                result += char
            else:
                result += " "
        return result

    @staticmethod
    def custom_strip(s):
        ascii_chars = "".join(chr(i) for i in range(128) if i < 65 or (90 < i < 97) or i > 122)
        return s.strip(ascii_chars)

    def mostCommonWord(self, paragraph: str, banned: list[str]) -> str:
        paragraph = paragraph.lower()
        paragraph = self.convert_non_letters_to_space(paragraph)
        words_tmp = paragraph.split(" ")

        words = dict()
        for word_tmp in words_tmp:
            word = self.custom_strip(word_tmp)
            words[word] = words.get(word, 0) + 1

        ans = str()
        flag = 0
        for word, count in words.items():
            if word in banned or word is "":
                continue
            if flag >= count:
                continue
            ans = word
            flag = count
        return ans
